import { defineStore } from "pinia";

export const useUserStore = defineStore("user", {
	state: () => {
		return {
			corpId: import.meta.env.VITE_APP_DEFAULT_CROPID,
			token: import.meta.env.VITE_APP_DEFAULT_TOKEN,
			userInfo: {},
		};
	},
	getters: {
		getToken: (state) => state.token,
	},
	actions: {
		updateState(partial) {
			this.$patch(partial);
		},
	},
	persist: {
		storage: localStorage,
	},
});
